import { Controller, Get, Post, Body, Patch, Param, Delete, Header, HttpCode } from '@nestjs/common';
import { SettleService } from './settle.service';
import { CreateSettleDto } from './dto/create-settle.dto';
import { UpdateSettleDto } from './dto/update-settle.dto';

@Controller('settle')
export class SettleController {
  constructor(private readonly settleService: SettleService) { }

  @Post()
  create(@Body() createSettleDto: CreateSettleDto) {
    return this.settleService.create(createSettleDto);
  }
  //陪玩结算list
  @Post('list')
  @Header('Content-Type', 'application/json')
  @HttpCode(200)
  findAll(@Body('pageNum') pageNum: number,
    @Body('pageSize') pageSize: number,
    @Body('playWithName') playWithName: string,) {
    return this.settleService.findAll(pageNum, pageSize, playWithName);
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.settleService.findOne(+id);
  }

  @Patch(':id')
  update(@Param('id') id: string, @Body() updateSettleDto: UpdateSettleDto) {
    return this.settleService.update(+id, updateSettleDto);
  }

  @Delete(':id')
  remove(@Param('id') id: string) {
    return this.settleService.remove(+id);
  }
  //结算
  @Post('statement')
  statement(@Body('playWithId') playWithId: string) {
    return this.settleService.statement(playWithId);
  }
}
